package com.liss.juc20211122.cf;

import java.util.concurrent.*;

/**
 * 使用CompletableFuture的runAsync()实现的一个例子
 */
public class CompletableFutureDemo {
    public static void main(String[] args) {
        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(1, 10, 1L, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(20), Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        CompletableFuture.runAsync(()-> System.out.println(Thread.currentThread().getName() + "/t" + "----come in"));

        CompletableFuture.runAsync(()-> System.out.println(Thread.currentThread().getName() + "/t" + "----come in"),poolExecutor);
    }
}
